package at.socialconference.web.client.util;

import at.socialconference.inter.connection.protocol.SocketProtocol;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class AsynCallbackDeleteObject implements AsyncCallback<Integer> {
	@Override
	public void onFailure(Throwable caught) {
		Window.alert("Could not reach server");	
	}
	@Override
	public void onSuccess(Integer result) {
		switch (result) {
			case SocketProtocol.RESP_WRONG_OBJECT:
				Window.alert("The passed object is not valid");
				break;
			case SocketProtocol.OK:
				Window.alert("Deleted successfully");
				break;
			case -1:
				Window.alert("Internal server error");
				break;
			default:
				Window.alert("Internal server error: Illegal state");
		}
	}
}
